<form id="form" action="{:url('store.index/edit')}">
<input type="hidden" name="id" value="{$info.id}"/>
<input type="hidden" name="original_uid" value="{$info.manage_uid}"/>
<div class="titlebar"><i class="iconfont icon-store_icon"></i>好店信息</div>
<table class="formtable">
    <tr><th>好店店长:</th>
        <td>
            <input readonly="readonly" id="manage_uid" class="input" type="text" name="manage_uid" value="{$info.manage_uid}"  />
            <button url="{:url('store.index/selectUid')}" data="manage_uid" type="button" class="selectPopup button"><i class="iconfont icon-my_icon"></i>选择用户</button>
            {if $info.manage_uid}
            <button url="{:url('system/passport.user/review',['uid' => $info.manage_uid])}" type="button" class="selectPopup button button-blue"><i class="iconfont icon-search_icon"></i>预览</button>
            {/if}
        </td>
    </tr>
    <tr><th>微信商户号:</th><td><input autocomplete="off" class="input" datatype="*" type="text" name="mch_id" value="{$info.mch_id}"/></td></tr>
    <tr><th>服务费:</th><td><input autocomplete="off" class="input" datatype="npot" type="text" name="charge" value="{$info.charge?:0}" /> %</td></tr>
    <tr><th>城市行政码:</th><td>
        <div data-toggle="distpicker" data-value-type="code">
            <input readonly id="citycode" datatype="n6-16" class="input" type="text" name="citycode" value="{$info.citycode}"/>
            <select name="province" data-province="{$info->citypath->province?:''}" class="province select"></select>
            <select name="city" data-city="{$info->citypath->city?:''}" class="city select"></select>
            <select name="district" data-district="{$info->citypath->district?:''}" class="district select"></select>
        </div>
    </td></tr>
    <tr><th>行业:</th><td>
        <select id="cate_id" class="select w200" datatype="*" name="cate_id">
            {foreach $cate as $vo}<option value="{$vo.id}" {if $vo.id == $info.cate_id}selected{/if}>{$vo.name}</option>{/foreach}
        </select>
        <select id="cate_sid" class="select w200" name="cate_sid">
            {foreach $cate_sub as $vo}<option value="{$vo.id}" {if $vo.id == $info.cate_sid}selected{/if}>{$vo.name}</option>{/foreach}
        </select>
    </td></tr>
    <tr><th>名称:</th><td><input class="input w400" datatype="*" type="text" name="name" value="{$info.name}" /></td></tr>
    <tr><th>电话:</th><td><input class="input" datatype="*" type="text" name="telphone" value="{$info.telphone}" /></td></tr>
    <tr><th>地址:</th><td>
        <input class="input w350" datatype="*" type="text" name="address" value="{$info.address}" />
        <button type="button" class="button button-green lib"><i class="iconfont icon-address_icon"></i>读取经纬</button>
        <input readonly="true" autocomplete="off" class="input w100 readonly" datatype="*" type="text" name="longitude" value="{$info.longitude}" />
        <input readonly="true" autocomplete="off" class="input w100 readonly" datatype="*" type="text" name="latitude" value="{$info.latitude}" />
    </td></tr>
    <tr><th>推荐关键词:</th><td>
        <input class="input w400" type="text" name="tags" value="{if !empty($info.tags)}{:implode(',',$info.tags)}{/if}" />
        <span class="gray">每个关键字以<span class="fn-fb red">逗号( , )</span>分开</span>
    </td></tr>
    <tr class="imgs">
        <th>
            <input type="hidden" name="img" id="img_index"  value="{$info.img}" /> 
        </th>
        <td id="imgbox">
            <div class="box-view fn-left fn-cp selectPopup" url="{:url('system/passport.common/upload')}"></div>
            {volist name="info.imgs" id="pic"}
            <div class="box-view fn-left fn-cp{if $info.img == $pic} current{/if}">
            <input type="hidden" name="imgs[]" value="{$pic}" /><img src="{$pic}" onclick="selectImg(this)">
            <div class="opera">
                <a class="imgbox-left" href="javascript:;"><i class="iconfont icon-arrowleft"></i></a>
                <a class="imgbox-right" href="javascript:;"><i class="iconfont icon-arrowright"></i></a>
                <a class="imgbox-link" href="javascript:;" onclick="linkImg(this)"><i class="iconfont icon-search_icon"></i></a>
                <a class="imgbox-close" href="javascript:;" onclick="delImg(this)"><i class="iconfont icon-close_icon"></i></a>
            </div>
        </div>{/volist}</td>
    </tr>
    <tr>
        <th></th>
        <td>
            <input type="submit" value="确定" class="button button-blue submit" />
            <input type="reset" value="重置" class="button button-blank"/>
        </td>
    </tr>
</table>
</form>
<script id="cate" type="text/html">{{each list value}}<option value="{{value.id}}">{{value.name}}</option>{{/each}}</script>
<script type="text/javascript">
Do('base','layer','form','tpl','city',function(){
    $('#form').isForm();
    $(".selectPopup").win();
    $(".lib").click(function () {
        var province = $(".province").val(),city = $(".city").val(),district = $(".district").val();
        var val = $("input[name='address']").val();
        $(this).popup({'url':'{:url("ais/store.index/baidu")}?address='+province+city+district+val,area: ['60%','550px']});
    });
    $("#cate_id").change(function(){
        var cate_id = $(this).val();
        $.getJSON('{:url("ais/store.index/storecate")}',{cate_id: cate_id},function (rel) {
            $("#cate_sid").html(template('cate',{list:rel.data}));
        });
    });
    bindEvent();
    //读取城市编码
    $(".district").change(function(){
        var province = $(".province").val(),city = $(".city").val(),district = $(".district").val();
        $.getJSON("{:url('common/cityCode')}",{'province':province,'city':city,'district':district},function(rel){
            if(rel.code == '200'){
                $("#citycode").val(rel.data)
            }
        });
    })
})
function setPoint(point){
    $("input[name='longitude']").val(point.lng);
    $("input[name='latitude']").val(point.lat);
}
</script>